<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<script src="js/bootstrap_5.1.1_js_bootstrap.bundle.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap_5.1.1_css_bootstrap.min.css">
<style>
    *{
    	margin: 0px;
    	padding: 0px;
    }
	body{
		background-color: rgb(245, 246, 250);
	}
	a{
		text-decoration: none;
		color: rgb(81, 210, 197);
	}
	a:hover{
		color: rgb(105, 109, 115);
	}
	#log{
		width: 50%;
		height: 100%;
	}
	.head_a{
		display:inline-block;
		font-size: 2vw;
	}
	.head{
		width: 100vw;
		background-color: white;
		height: 10vh;
	}
	.serchtext{
		position:relative;
		top:2vh;
		width:20vw;
		height:5vh;
	}
	.serchbtn{
		color:white;
		background-color:rgb(0, 174, 236);
		position:relative;
		top:2vh;
		width:5vw;
		height:5vh;
	}
	.dropdown{
		position:absolute;
		right:10vw;
		top:-1vh;
	}
	.left{
		height: 100%;
		width: 20vw;
	}
	.user{
		height: 50%;
		line-height: 500%;
	}
	.left_text{
		color: rgb(197, 197, 197);
     font-size: 2.5vh;
	}
	#box{
		width: 100vw;
		height: 80vh;
	}
	#box ul li{
		width: 100%;
		height: 6vh;
		line-height: 300%;
		list-style: none;
		text-align: center;
		background-color: rgb(39, 40, 34);
	}
	#boxleft a:hover{
    color: white;
	}
	#box ul{
		margin-top: 2vh;
	}
	.l{
		line-height: 200%;
		height: 5vh;
	}
	.li_style{
		width: 100%;
		height: 6vh;
		line-height: 200%;
		border-right: solid 0.5vh rgb(51, 202, 187);
	}

	#right{
		margin-top: 2vh;
		margin-right: 2vw;
		border: 1px solid;
		width: 78vw;
		height: 80vh;
		position: absolute;
		right: 0vw;
	}
</style>
<body>
	<div class="container-fluid">
		<div class="head row">
			<div class="col-md-3" id="head_left">
				<img src="img/logo.png" alt="" id="log">
				<span class="left_text">后台管理页面</span>
			</div>
		    <input type="text"  class="form-control serchtext" placeholder="请输入搜索条件">
		    <button class="btn serchbtn">搜索</button>
		</div>
		<div class="user col-md-1 offset-md-7 text-center">
        <div class="dropdown">
              <a href="" class="head_a" data-bs-toggle="dropdown" id="a1">adminname</a>
              <ul class="dropdown-menu">
                <li><input type="button" name="" class="dropdown-item l" value="修改昵称" data-bs-toggle="modal" data-bs-target="#myModal"></li>
                <li><input type="button" name="" class="dropdown-item l" value="修改密码" data-bs-toggle="modal" data-bs-target="#myModal_1"></li>
                <li><a class="dropdown-item l" href="admin_login.html">退出登录</a></li>
              </ul>
        </div>
		</div>
		</div>
		<div class=" row" id="box">
			<ul class="col-md-2" id="boxleft">
			  <a href="#"><li class="li" id="li1">用户管理</li></a> 
				<a href="#"><li class="li" id="li2">板块管理</li></a>
				<a href="#"><li class="li" id="li3">帖子审核</li></a>
				<a href="#"><li class="li" id="li4">帖子管理</li></a>
				<a href="#"><li class="li" id="li5">用户注册管理</li></a>
				<a href="#"><li class="li" id="li6">管理员管理</li></a>
			</ul>
			<div id="right">
				<table class="table table-hover table-bordered">
		            <thead>
		                
		            </thead>
		            <tbody>
		            	
		            </tbody>
		        </table>
		        <div class='pageBar'></div>
			</div>
		</div>
	</div>
<div class="modal fade" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">修改昵称</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
      </div>
      <div class="modal-body">
        	<input type="text" class="form-control" placeholder="请输入新的昵称">
      </div>
      <div class="modal-footer">
      	<button type="submit" class="btn btn-primary">确定</button>
        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
  </div>
  <div>
	<div class="modal fade" id="myModal_1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">修改密码</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
      </div>
      <div class="modal-body">
        	<input type="password" class="form-control" placeholder="请输入新的密码">
        	<hr style="border: 0.1vh dashed;">
        	<input type="password" class="form-control" placeholder="请再次输入密码">
      </div>
      <div class="modal-footer">
      	<button type="submit" class="btn btn-primary">确定</button>
        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
	</div>
</div>
<script src="js/jquery.min.js"></script>
<script>
	$(".li").mouseenter(function(event) {
		$(this).addClass('li_style');
	}).mouseleave(function(event) {
		$(this).removeClass('li_style');
	});
	
	var params = location.search.substring(1);
	window.onload=function(){
		searchUser(1,15);
		Admin();
	}	
	var currentPage;
		function searchUser(pageNum,pageSize){
			$.ajax({
				type:"POST",
				url:"Admin.do",
				data:{
					pageNum:pageNum,
					pageSize:pageSize
				},
				success:function(data){
					$("tbody").empty();
					$("thead").empty();
					currentPage = data.pageNum;
					var users=data.data;
					var $tr =$("<tr></tr>");
					var $td1 = $("<td></td>").text("序号");
					var $td2 = $("<td></td>").text("用户名");
					var $td3 = $("<td></td>").html("用户性别");
					var $td4 = $("<td></td>").text("用户电话");
					var $td5 = $("<td></td>").text("用户邮箱");
					var $td6 = $("<td></td>").html("注册时间");
					var $td7 = $("<td></td>").html("登录状态");
					var $td8 = $("<td></td>").html("操作");
					$tr.append($td1) 
					.append($td2)
					.append($td3)
					.append($td4)
					.append($td5)
					.append($td6)
					.append($td7)
					.append($td8);
				$("thead").append($tr);
					for(var i=0;i<users.length;i++ ){
						var user=users[i];
						var $tr =$("<tr></tr>");
						var $td1 = $("<td></td>").text(i+1);
						var $td2 = $("<td></td>").text(user.userName);
						var $td3 = $("<td></td>").text(user.userSex);
						var $td4 = $("<td></td>").text(user.userPhone);
						var $td5 = $("<td></td>").text(user.userEmail);
						var time = new Date(user.regDate);
						var year= time.getFullYear()  //年
					    var month = ("0" + (time.getMonth() + 1)).slice(-2); //月
					    var day = ("0" + time.getDate()).slice(-2); //日
					     var mydate = year + "-" + month + "-" + day;
						var $td6 = $("<td></td>").text(mydate);
						var $td7 = $("<td></td>").text(user.userState)
						var $td8 = $("<td></td>").html("<button onclick='delUser("+user.userId+")'>删除</button> <button onclick='updBook()'>修改</button>");
						$tr.append($td1)
							.append($td2)
							.append($td3)
							.append($td4)
							.append($td5)
							.append($td6)
							.append($td7)
							.append($td8);
						$("tbody").append($tr)
						
					}
					makePageBar(data)
				}
			})
		}
		function makePageBar(data){
			$(".pageBar").empty();
			var totalPages = data.totalPages;
			var hasPrev = data.hasPrev;
			var hasNext = data.hasNext;
			var pageNum = data.pageNum;
			if(hasPrev){
				var $firstBtn = $("<a onclick='searchUser(1,15)' href='javascript:void(0);'>首页</a>");
				var $prevBtn = $("<a onclick='searchUser("+(pageNum-1)+",15)' href='javascript:void(0);'>上一页</a>");
				$(".pageBar").append($firstBtn).append($prevBtn);
			}
			
			for(var i =1; i<=totalPages;i++){
				var $pageBtn = $("<a onclick='searchUser("+i+",15)' href='javascript:void(0);'></a>").text(i);
				$(".pageBar").append($pageBtn);
			}
			if(hasNext){
				var $lastBtn = $("<a onclick='searchUser("+totalPages+",15)' href='javascript:void(0);'>尾页</a>");
				var $nextBtn = $("<a onclick='searchUser("+(pageNum+1)+",15)' href='javascript:void(0);'>下一页</a>");
				$(".pageBar").append($nextBtn).append($lastBtn);
			}
		}
		function delUser(userId){
			$.ajax({
				type:"POST",
				url:"delUser.do",
				data:{userId:userId},
				success:function(data){
					if(data == 1){
						searchUser(currentPage,15);
					}
				}	
			});
		}
		
		function Admin(){
			$.ajax({
				type:"POST",
				url:"AdminById.do",
				data:{
					adminId:params.substring(3)
				},
				success:function(data){
					$("#a1").text(data.adminName+":"+data.adminLevel);
				}
			})
		}
		
		$("#li1").click(function(){
			searchUser(1,15);
		})
		$("#li2").click(function(){
			searchAllPlate(1,10);
		})
		$("#li3").click(function(){
			searchPostCheck(1,15);
		})
		$("#li4").click(function(){
			searchPost(1,15);
		})
		$("#li5").click(function(){
			searchUsercheck(1,15);
		})
		$("#li6").click(function(){
			console.log();
			if($("#a1").text().split(":")[1] == "2"){
				searchAdmin(1,15);
			}
		})
		var currentPage1=0;
		function searchAllPlate(pageNum,pageSize){
		$.ajax({
			type:"POST",
			url:"AllPlate.do",
			data:{
				pageNum:pageNum,
				pageSize:pageSize
			},
			success:function(data){
				$("tbody").empty();
				$("thead").empty();
				console.log(data);
				currentPage1 = data.pageNum;
				var plates = data.data;
				var $tr =$("<tr></tr>");
				var $td1 = $("<td></td>").text("板块id");
				var $td2 = $("<td></td>").text("板块名字");
				var $td3 = $("<td></td>").html("板块图标");
				var $td4 = $("<td></td>").text("板块图标");
				var $td5 = $("<td></td>").text("创建时间");
				var $td6 = $("<td></td>").html("操作<button onclick='updPlate()'>添加</button>");
				$tr.append($td1) 
				.append($td2)
				.append($td3)
				.append($td4)
				.append($td5)
				.append($td6);
			$("thead").append($tr);
				for(var i =0 ;i<plates.length;i++){
					var plate=plates[i];
					var $tr =$("<tr></tr>");
					var $td1 = $("<td></td>").text(i+1);
					var $td2 = $("<td></td>").text(plate.plateName);
					var $td3 = $("<td></td>").html("<img src='"+plate.plateIconImg+"' style='width:3vw'/>");
					var $td4 = $("<td></td>").text(plate.plateState);
					var time = new Date(plate.regDate);
					var year= time.getFullYear()  //年
				    var month = ("0" + (time.getMonth() + 1)).slice(-2); //月
				    var day = ("0" + time.getDate()).slice(-2); //日
				    var mydate = year + "-" + month + "-" + day;
					var $td5 = $("<td></td>").text(mydate);
					var $td6 = $("<td></td>").html("<button onclick='delPlate("+plate.plateId+")'>删除</button>");
					$tr.append($td1)
						.append($td2)
						.append($td3)
						.append($td4)
						.append($td5)
						.append($td6);
					$("tbody").append($tr)
				}
				makePageBarplate(data);
			}
		})
	}
		function makePageBarplate(data){
			$(".pageBar").empty();
			var totalPages = data.totalPages;
			var hasPrev = data.hasPrev;
			var hasNext = data.hasNext;
			var pageNum = data.pageNum;
			if(hasPrev){
				var $firstBtn = $("<a onclick='searchAllPlate(1,10)' href='javascript:void(0);'>首页</a>");
				var $prevBtn = $("<a onclick='searchAllPlate("+(pageNum-1)+",10)' href='javascript:void(0);'>上一页</a>");
				$(".pageBar").append($firstBtn).append($prevBtn);
			}
			
			for(var i =1; i<=totalPages;i++){
				var $pageBtn = $("<a onclick='searchAllPlate("+i+",10)' href='javascript:void(0);'></a>").text(i);
				$(".pageBar").append($pageBtn);
			}
			if(hasNext){
				var $lastBtn = $("<a onclick='searchAllPlate("+totalPages+",10)' href='javascript:void(0);'>尾页</a>");
				var $nextBtn = $("<a onclick='searchAllPlate("+(pageNum+1)+",10)' href='javascript:void(0);'>下一页</a>");
				$(".pageBar").append($nextBtn).append($lastBtn);
			}
		}
		function delPlate(plateId){
			$.ajax({
				type:"POST",
				url:"delPlate.do",
				data:{plateId:plateId},
				success:function(data){
					if(data == 1){
						searchAllPlate(currentPage1,10);
					}
				}	
			});
		}
		var currentPage2=0;
		function searchPostCheck(pageNum,pageSize){
			$.ajax({
				type:"POST",
				url:"postCheck.do",
				data:{
					pageNum:pageNum,
					pageSize:pageSize
				},
				success:function(data){
					var posts=data.data;
					$("tbody").empty();
					$("thead").empty();
					currentPage2 = data.pageNum;
					var $tr =$("<tr></tr>");
					var $td1 = $("<td></td>").text("序号");
					var $td2 = $("<td></td>").text("帖子标题");
					var $td3 = $("<td></td>").text("帖子内容");
					var $td4 = $("<td></td>").text("帖子所属用户");
					var $td5 = $("<td></td>").text("帖子状态");
					var $td6 = $("<td></td>").text("创建时间");
					var $td7 = $("<td></td>").html("操作");
					$tr.append($td1) 
					.append($td2)
					.append($td3)
					.append($td4)
					.append($td5)
					.append($td6)
					.append($td7);
				$("thead").append($tr);
					for(var i=0;i<posts.length;i++ ){
						var post=posts[i];
						var $tr =$("<tr></tr>");
						var $td1 = $("<td></td>").text(i+1);
						var str2=post.postText.split("<h3>").join("").split("</h3>").join("").substring(0,20)+"...";
						var $td2 = $("<td></td>").text(str2);
						var str1=post.postText.split("<p>").join("").split("</P>").join("").split("<P>").join("").split("</p>").join("").substring(0,20)+"...";
						var $td3 = $("<td></td>").text(str1);
						var $td4 = $("<td></td>").text(post.postUserId);
						var $td5 = $("<td></td>").text(post.postState)
						var time = new Date(post.creationTime);
						var year= time.getFullYear()  //年
					    var month = ("0" + (time.getMonth() + 1)).slice(-2); //月
					    var day = ("0" + time.getDate()).slice(-2); //日
					     var mydate = year + "-" + month + "-" + day;
						var $td6 = $("<td></td>").text(mydate);
						var $td7 = $("<td></td>").html("<button onclick='delPostCheck("+post.postId+")'>通过</button> <button onclick='del()'>不通过</button>");
						$tr.append($td1)
							.append($td2)
							.append($td3)
							.append($td4)
							.append($td5)
							.append($td6)
							.append($td7);
						$("tbody").append($tr)
						
					}
					makePageBarpostCheck(data)
				}
			})
		}
		function makePageBarpostCheck(data){
			$(".pageBar").empty();
			var totalPages = data.totalPages;
			var hasPrev = data.hasPrev;
			var hasNext = data.hasNext;
			var pageNum = data.pageNum;
			if(hasPrev){
				var $firstBtn = $("<a onclick='searchPostCheck(1,15)' href='javascript:void(0);'>首页</a>");
				var $prevBtn = $("<a onclick='searchPostCheck("+(pageNum-1)+",10)' href='javascript:void(0);'>上一页</a>");
				$(".pageBar").append($firstBtn).append($prevBtn);
			}
			
			for(var i =1; i<=totalPages;i++){
				var $pageBtn = $("<a onclick='searchPostCheck("+i+",15)' href='javascript:void(0);'></a>").text(i);
				$(".pageBar").append($pageBtn);
			}
			if(hasNext){
				var $lastBtn = $("<a onclick='searchPostCheck("+totalPages+",15)' href='javascript:void(0);'>尾页</a>");
				var $nextBtn = $("<a onclick='searchPostCheck("+(pageNum+1)+",15)' href='javascript:void(0);'>下一页</a>");
				$(".pageBar").append($nextBtn).append($lastBtn);
			}
		}
		function delPostCheck(postId){
			$.ajax({
				type:"POST",
				url:"delPostCheck.do",
				data:{postId:postId},
				success:function(data){
					if(data == 1){
						searchPostCheck(currentPage2,15);
					}
				}	
			});
		}
		var currentPage3=0;
		function searchPost(pageNum,pageSize){
			$.ajax({
				type:"POST",
				url:"post.do",
				data:{
					pageNum:pageNum,
					pageSize:pageSize
				},
				success:function(data){
					var posts=data.data;
					$("tbody").empty();
					$("thead").empty();
					currentPage3 = data.pageNum;
					var $tr =$("<tr></tr>");
					var $td1 = $("<td></td>").text("序号");
					var $td2 = $("<td></td>").text("帖子标题");
					var $td3 = $("<td></td>").text("帖子内容");
					var $td4 = $("<td></td>").text("帖子所属用户");
					var $td5 = $("<td></td>").text("帖子状态");
					var $td6 = $("<td></td>").text("创建时间");
					var $td7 = $("<td></td>").html("操作");
					$tr.append($td1) 
					.append($td2)
					.append($td3)
					.append($td4)
					.append($td5)
					.append($td6)
					.append($td7);
				$("thead").append($tr);
					for(var i=0;i<posts.length;i++ ){
						var post=posts[i];
						var $tr =$("<tr></tr>");
						var $td1 = $("<td></td>").text(i+1);
						var str2=post.postText.split("<h3>").join("").split("</h3>").join("").substring(0,20)+"...";
						var $td2 = $("<td></td>").text(str2);
						var str1=post.postText.split("<p>").join("").split("</P>").join("").split("<P>").join("").split("</p>").join("").substring(0,20)+"...";
						var $td3 = $("<td></td>").text(str1);
						var $td4 = $("<td></td>").text(post.postUserId);
						var $td5 = $("<td></td>").text(post.postState)
						var time = new Date(post.creationTime);
						var year= time.getFullYear()  //年
					    var month = ("0" + (time.getMonth() + 1)).slice(-2); //月
					    var day = ("0" + time.getDate()).slice(-2); //日
					     var mydate = year + "-" + month + "-" + day;
						var $td6 = $("<td></td>").text(mydate);
						var $td7 = $("<td></td>").html("<button onclick='delPost("+post.postId+")'>冻结</button>");
						$tr.append($td1)
							.append($td2)
							.append($td3)
							.append($td4)
							.append($td5)
							.append($td6)
							.append($td7);
						$("tbody").append($tr)
						
					}
					makePageBarPost(data)
				}
			})
		}
		function makePageBarPost(data){
			$(".pageBar").empty();
			var totalPages = data.totalPages;
			var hasPrev = data.hasPrev;
			var hasNext = data.hasNext;
			var pageNum = data.pageNum;
			if(hasPrev){
				var $firstBtn = $("<a onclick='searchPost(1,15)' href='javascript:void(0);'>首页</a>");
				var $prevBtn = $("<a onclick='searchPost("+(pageNum-1)+",10)' href='javascript:void(0);'>上一页</a>");
				$(".pageBar").append($firstBtn).append($prevBtn);
			}
			
			for(var i =1; i<=totalPages;i++){
				var $pageBtn = $("<a onclick='searchPost("+i+",15)' href='javascript:void(0);'></a>").text(i);
				$(".pageBar").append($pageBtn);
			}
			if(hasNext){
				var $lastBtn = $("<a onclick='searchPost("+totalPages+",15)' href='javascript:void(0);'>尾页</a>");
				var $nextBtn = $("<a onclick='searchPost("+(pageNum+1)+",15)' href='javascript:void(0);'>下一页</a>");
				$(".pageBar").append($nextBtn).append($lastBtn);
			}
		}
		function delPost(postId){
			$.ajax({
				type:"POST",
				url:"delPost.do",
				data:{postId:postId},
				success:function(data){
					if(data == 1){
						searchPost(currentPage3,15);
					}
				}	
			});
		}
		var currentPage4=0;
		function searchUsercheck(pageNum,pageSize){
			$.ajax({
				type:"POST",
				url:"Usercheck.do",
				data:{
					pageNum:pageNum,
					pageSize:pageSize
				},
				success:function(data){
					var userChecks=data.data;
					$("tbody").empty();
					$("thead").empty();
					currentPage4 = data.pageNum;
					var $tr =$("<tr></tr>");
					var $td1 = $("<td></td>").text("用户Id");
					var $td2 = $("<td></td>").text("用户名");
					var $td3 = $("<td></td>").text("用户性别");
					var $td4 = $("<td></td>").text("用户电话");
					var $td5 = $("<td></td>").text("用户邮箱");
					var $td6 = $("<td></td>").text("注册时间");
					var $td7 = $("<td></td>").text("用户头像");
					var $td8 = $("<td></td>").html("操作");
					$tr.append($td1) 
					.append($td2)
					.append($td3)
					.append($td4)
					.append($td5)
					.append($td6)
					.append($td7).append($td8);
				$("thead").append($tr);
					for(var i=0;i<userChecks.length;i++ ){
						var usercheck=userChecks[i];
						var $tr =$("<tr></tr>");
						var $td1 = $("<td></td>").text(i+1);
						var $td2 = $("<td></td>").text(usercheck.userName);
						var $td3 = $("<td></td>").text(usercheck.userSex);
						var $td4 = $("<td></td>").text(usercheck.userPhone);
						var $td5 = $("<td></td>").text(usercheck.userEmail);
						var time = new Date(usercheck.regDate);
						var year= time.getFullYear()  //年
					    var month = ("0" + (time.getMonth() + 1)).slice(-2); //月
					    var day = ("0" + time.getDate()).slice(-2); //日
					     var mydate = year + "-" + month + "-" + day;
						var $td6 = $("<td></td>").text(mydate);
						var $td7 = $("<td></td>").html("<img src='"+usercheck.userHeadImg+"' style='width:3vw'/>");
						var $td8 = $("<td></td>").html("<button onclick='delUserCheck("+usercheck.userId+")'>通过</button> <button onclick='del()'>不通过</button>");
						$tr.append($td1)
							.append($td2)
							.append($td3)
							.append($td4)
							.append($td5)
							.append($td6)
							.append($td7)
							.append($td8);
						$("tbody").append($tr)
						
					}
					makePageBarcheckuser(data)
				}
			})
		}
		function makePageBarcheckuser(data){
			$(".pageBar").empty();
			var totalPages = data.totalPages;
			var hasPrev = data.hasPrev;
			var hasNext = data.hasNext;
			var pageNum = data.pageNum;
			if(hasPrev){
				var $firstBtn = $("<a onclick='searchUsercheck(1,15)' href='javascript:void(0);'>首页</a>");
				var $prevBtn = $("<a onclick='searchUsercheck("+(pageNum-1)+",10)' href='javascript:void(0);'>上一页</a>");
				$(".pageBar").append($firstBtn).append($prevBtn);
			}
			
			for(var i =1; i<=totalPages;i++){
				var $pageBtn = $("<a onclick='searchUsercheck("+i+",15)' href='javascript:void(0);'></a>").text(i);
				$(".pageBar").append($pageBtn);
			}
			if(hasNext){
				var $lastBtn = $("<a onclick='searchUsercheck("+totalPages+",15)' href='javascript:void(0);'>尾页</a>");
				var $nextBtn = $("<a onclick='searchUsercheck("+(pageNum+1)+",15)' href='javascript:void(0);'>下一页</a>");
				$(".pageBar").append($nextBtn).append($lastBtn);
			}
		}
		function delUserCheck(userId){
			$.ajax({
				type:"POST",
				url:"delUserCheck.do",
				data:{userId:userId},
				success:function(data){
					if(data == 1){
						searchUsercheck(currentPage4,15);
					}
				}	
			});
		}
		var currentPage5=0;
		function searchAdmin(pageNum,pageSize){
			$.ajax({
				type:"POST",
				url:"Admins.do",
				data:{
					pageNum:pageNum,
					pageSize:pageSize
				},
				success:function(data){
					var Admins=data.data;
					$("tbody").empty();
					$("thead").empty();
					currentPage5 = data.pageNum;
					var $tr =$("<tr></tr>");
					var $td1 = $("<td></td>").text("管理员Id");
					var $td2 = $("<td></td>").text("用户名");
					var $td3 = $("<td></td>").text("密码");
					var $td4 = $("<td></td>").text("注册时间");
					var $td5 = $("<td></td>").html("操作");
					$tr.append($td1) 
					.append($td2)
					.append($td3)
					.append($td4)
					.append($td5);
				$("thead").append($tr);
					for(var i=0;i<Admins.length;i++ ){
						var admin=Admins[i];
						var $tr =$("<tr></tr>");
						var $td1 = $("<td></td>").text(i+1);
						var $td2 = $("<td></td>").text(admin.adminName);
						var $td3 = $("<td></td>").text(admin.adminPass);
						var time = new Date(admin.regDate);
						var year= time.getFullYear()  //年
					    var month = ("0" + (time.getMonth() + 1)).slice(-2); //月
					    var day = ("0" + time.getDate()).slice(-2); //日
					     var mydate = year + "-" + month + "-" + day;
						var $td4 = $("<td></td>").text(mydate);
						var $td5 = $("<td></td>").html("<button onclick='delBook("+admin.adminId+")'>删除</button>");
						$tr.append($td1)
							.append($td2)
							.append($td3)
							.append($td4)
							.append($td5);
						$("tbody").append($tr)
					}
					var $tr1 = $("<tr></tr>");
					var $td8 = $("<td colspan='5'></td>").html("<button onclick='delBook()'>添加</button>");
					$tr1.append($td8);
					$("tbody").append($tr1);
					makePageBaradmin(data)
				}
			})
		}
		function makePageBaradmin(data){
			$(".pageBar").empty();
			var totalPages = data.totalPages;
			var hasPrev = data.hasPrev;
			var hasNext = data.hasNext;
			var pageNum = data.pageNum;
			if(hasPrev){
				var $firstBtn = $("<a onclick='searchAdmin(1,15)' href='javascript:void(0);'>首页</a>");
				var $prevBtn = $("<a onclick='searchAdmin("+(pageNum-1)+",10)' href='javascript:void(0);'>上一页</a>");
				$(".pageBar").append($firstBtn).append($prevBtn);
			}
			
			for(var i =1; i<=totalPages;i++){
				var $pageBtn = $("<a onclick='searchAdmin("+i+",15)' href='javascript:void(0);'></a>").text(i);
				$(".pageBar").append($pageBtn);
			}
			if(hasNext){
				var $lastBtn = $("<a onclick='searchAdmin("+totalPages+",15)' href='javascript:void(0);'>尾页</a>");
				var $nextBtn = $("<a onclick='searchAdmin("+(pageNum+1)+",15)' href='javascript:void(0);'>下一页</a>");
				$(".pageBar").append($nextBtn).append($lastBtn);
			}
		}
		function delAdmin(adminId){
			$.ajax({
				type:"POST",
				url:"delAdmin.do",
				data:{adminId:adminId},
				success:function(data){
					if(data == 1){
						searchAdmin(currentPage5,15);
					}
				}	
			});
		}
</script>
</body>
</html>